MAPS
Photo by Visit Greenland on Unsplash
How do you find America? Turn left at Greenland…
— Ringo Starr, media question to Beatles during first U.S. tour 1964
df <- read.csv("archetypes/climate-classification/world-climates-koppen-geiger.csv", header = TRUE, stringsAsFactors = FALSE)
head(df, n=10)
unique(df$climates_f)
## [1] "ET" "EF" "" "Dfd" "Dfc" "Dsc" "Dsd" "Bsk" "Cfc" "Dwd" "Cfb" "Csc"
## [13] "Dfb" "Dwc" "Dwb" "Dsb" "CSb" "Dfa" "Bwk" "Dwa" "Csa" "Cfa" "Dsa" "Cwa"
## [25] "BSh" "BWh" "Cwb" "Cwc" "Am" "AW" "As" "Af"
climate_zone_map <- st_read("archetypes/climate-classification/world-climates-koppen-geiger.geojson")
## Reading layer `world-climates-koppen-geiger' from data source
## `C:\Users\jaybe\Desktop\kamino-dev\sources\10-maps\2-area\4-contour\archetypes\climate-classification\world-climates-koppen-geiger.geojson'
## using driver `GeoJSON'
## Simple feature collection with 25143 features and 2 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: -180 ymin: -90 xmax: 180 ymax: 90
## Geodetic CRS: WGS 84
climate_zone_map_enriched <-
climate_zone_map %>%
mutate(
main = case_when(
str_detect(climates_f, "^A") ~ "Equatorial climates",
str_detect(climates_f, "^B") ~ "Arid climates",
str_detect(climates_f, "^C") ~ "Warm temperate climates",
str_detect(climates_f, "^D") ~ "Snow climates",
str_detect(climates_f, "^E") ~ "Polar climates",
TRUE ~ NA_character_
),
type = case_when(
str_detect(climates_f, "^Af") ~ "Equatorial rainforest, fully humid",
str_detect(climates_f, "^Am") ~ "Equatorial monsoon",
str_detect(climates_f, "^As") ~ "Equatorial savannah with dry summer",
str_detect(climates_f, "^AW") ~ "Equatorial savannah with dry winter",
str_detect(climates_f, "^BS") ~ "Arid steppe climate",
str_detect(climates_f, "^Bs") ~ "Arid steppe climate",
str_detect(climates_f, "^BW") ~ "Arid desert climate",
str_detect(climates_f, "^Bw") ~ "Arid desert climate",
str_detect(climates_f, "^CS") ~ "Warm temperate climate with dry summer",
str_detect(climates_f, "^Cs") ~ "Warm temperate climate with dry summer",
str_detect(climates_f, "^Cw") ~ "Warm temperate climate with dry winter",
str_detect(climates_f, "^Cf") ~ "Warm temperate climate, fully humid",
str_detect(climates_f, "^Ds") ~ "Snow climate with dry summer",
str_detect(climates_f, "^Dw") ~ "Snow climate with dry winter",
str_detect(climates_f, "^Df") ~ "Snow climate, fully humid",
str_detect(climates_f, "ET") ~ "Polar tundra climate",
str_detect(climates_f, "EF") ~ "Polar frost climate",
TRUE ~ NA_character_
),
type = factor(type, levels = c(
"Equatorial rainforest, fully humid",
"Equatorial monsoon",
"Equatorial savannah with dry summer",
"Equatorial savannah with dry winter",
"Arid steppe climate",
"Arid desert climate",
"Warm temperate climate with dry summer",
"Warm temperate climate with dry winter",
"Warm temperate climate, fully humid",
"Snow climate with dry summer",
"Snow climate with dry winter",
"Snow climate, fully humid",
"Polar tundra climate",
"Polar frost climate",
TRUE ~ NA_character_
))
) %>%
filter(!is.na(type))
climate_zone_map_enriched
theme_opts <- theme(
text = element_text(family = "inconsolata", size = 12),
plot.title = element_text(color = "black", size = 16, face = "bold"),
plot.subtitle = element_text(color = "black", size = 12),
plot.caption = element_text(color = "#555555", size = 11),
plot.background = element_rect(fill = "#f0f0f0", color = NA),
plot.margin = margin(.25, .25, .25, .25, "cm"),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.text.x = element_blank(),
axis.text.y = element_blank(),
panel.border = element_blank(),
panel.background = element_rect(fill = "#f0f0f0", color = NA),
# panel.grid.minor = element_blank(),
# panel.grid.major = element_blank(),
legend.position = 'bottom',
legend.title = element_blank(), #change legend title font size
legend.text = element_text(size=10)
)
fill_palette <- c(
"#4f3314",
"#784e1e",
"#a16928",
"#ca8432",
"#ca9273",
"#d8af98",
"#e7daae",
"#dbd787",
"#cbcf60",
"#b6ccca",
"#98b7b4",
"#7aa29e",
"#36b9cd",
"#2890a0"
)
color_palette <- darken(fill_palette, 0.1)
v1 = ggplot(data = climate_zone_map_enriched) +
geom_sf(aes(fill=type, color=type), stroke=0.5) +
scale_fill_manual( values = fill_palette ) +
scale_color_manual( values = color_palette ) +
coord_sf() +
ggtitle( "Köppen-Geiger Climate Zones" ) +
theme_void() +
theme_opts
girafe( ggobj = v1, width_svg = 16, height_svg = 9,
options = list( opts_sizing(rescale = TRUE, width = 1.0) )
)